home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Demos / Tools / QC™ 1.1.3 / QCAPI / QCAPI Reference / QCAPI Reference.rsrc / TEXT_130.txt < prev    next >
Encoding:
Text File  |  1995-04-23  |  8.3 KB  |  240 lines

  1.  
  2. API Calls
  3.  
  4. The following section describes the full set of QC API calls.  The API uses C interfaces, which are supplied for use in your projects, are the file QCAPI.h.
  5.  
  6.  
  7.  
  8. QCInstalled
  9.  
  10. INTERFACE
  11. QCErr    QCInstalled(void);
  12.  
  13. DESCRIPTION
  14. Test for the existance of the QC extension and availability of the API.
  15.  
  16. RESULTS
  17. Returns kQCNoErr (0) if the extension is loaded and no errors have occurred.
  18. Can possibly return kQCNotInstalled, kQCAPIMismatch.  See Appendix A for result code descriptions.
  19.  
  20.  
  21. QCIsActive
  22.  
  23. INTERFACE
  24. Boolean    QCIsActive(void);
  25.  
  26. DESCRIPTION
  27. Test to see if the current state of QCis active or not.
  28.  
  29. RESULTS
  30. Returns true (1) if testing is currently active on an application.
  31. Returns false (0)if testing is not currently active on any application heaps.
  32.  
  33.  
  34. QCActivate
  35.  
  36. INTERFACE
  37. QCErr    QCActivate(THz);
  38.  
  39. DESCRIPTION
  40. Activate QC testing on a given heap.  Passing NIL will activate testing on the current application's heap zone.
  41.  
  42. RESULTS
  43. Possible error results are kQCNotInstalled. If QC is already active on a particular heap, testing will cease on the current heap and begin on the specified heap.
  44.  
  45.  
  46. QCDeActivate
  47.  
  48. INTERFACE
  49. Boolean    QCDeActivate(void);
  50.  
  51. DESCRIPTION
  52. Deactivate testing on the currently active application heap.
  53.  
  54.  
  55. QCTestingHeap
  56.  
  57. INTERFACE
  58. THz    QCTestingHeap(void);
  59.  
  60. DESCRIPTION
  61. Get the current heap zone being tested.  This call can be useful if you plan on deactivating all tests, then reactivating them later on in your code, possibly alternating heaps in between.
  62.  
  63.  
  64. QCGetState
  65.  
  66. INTERFACE
  67. QCStateHandle    QCGetState(void);
  68.  
  69. DESCRIPTION
  70. Get the current state of QC testing for later restore.  This call is useful if you wish to save the current state of QC testing, then set/clear the tests you desire for a particular section of code, then restore the state of testing to what it was before.
  71.  
  72. It is important to note that the APIallocates the result and it is the responsibility of the caller to dispose of that memory with QCDisposeState().
  73.  
  74. WARNING
  75. The format of the data contained in QCStateHandle is undocumented and may change in the future.  Any direct manipulation of the contents of QCStateHandle is discouraged and may not work in future versions of QC.
  76.  
  77. RESULTS
  78. If QC is not currently active, NIL will be returned.
  79.  
  80.  
  81. QCSetState
  82.  
  83. INTERFACE
  84. QCErr    QCSetState(QCStateHandle);
  85.  
  86. DESCRIPTION
  87. Set the current state of QC testing to the state saved in QCStateHandle.  Testing must be active or kQCNotActive will be returned.
  88.  
  89. It is the responsibility of the caller to dispose of the memory allocated in QCStateHandle with QCDisposeState().
  90.  
  91. WARNING
  92. The format of the data contained in QCStateHandle is undocumented and may change in the future.  Any direct manipulation of the contents of QCStateHandle is discouraged and may not work in future versions of QC.
  93.  
  94.  
  95. QCDisposeState
  96.  
  97. INTERFACE
  98. QCErr    QCDisposeState(QCStateHandle);
  99.  
  100. DESCRIPTION
  101. Dispose of valid QCStateHandle information (acquired from a call to QCGetState()).
  102.  
  103. RESULTS
  104. If the given state information is not valid, kQCInvalidParam will be returned.
  105.  
  106.  
  107. QCInstallHandler
  108.  
  109. INTERFACE
  110. QCErr    QCInstallHandler(QCCallBackUPP, long);
  111.  
  112. DESCRIPTION
  113. Install a routine that will be called by QC when errors are encountered.  The supplied QCCallBackUPP routine is called by QCwhenever an error is encountered for an active test.  The 'long' value is passed to the callback routine in QCPBRecPtr->data.  A good way to get back at your globals is to use this long to save/restore the current A4/A5.  The specified routine is called with a pointer to a QCPBRec (see Appendix C).  This routine must be resident at all times, or until the handler is removed.  See Appendix C for details about the routine interface.  It is important to note that this call will replace any previous handler that may have been installed.
  114.  
  115. Multiple Error Handlers
  116. You can install multiple error handlers with the QCInstallHandler() and remove specified handlers with the QCRemoveHandler() call.  These error handlers can be installed by different applications other than the one being tested.  As an example, the BadAPPL sample application installs an error handler to detect if an intentional error was detected.  Another application (e.g. another process) could install an error handler to log the output.  If the process that installed an error handler forgets to remove it, and then quits (ExitToShell), QC will not call that error handler and it will be removed from the list.
  117.  
  118.  
  119. QCRemoveHandler
  120.  
  121. INTERFACE
  122. QCErr    QCRemoveHandler(QCCallBackUPP);
  123.  
  124. DESCRIPTION
  125. Remove (de-install) the specified error handler.  This will be the same QCCallBackUPP previously installed with QCInstallHandler().
  126.  
  127. RESULTS
  128. If the specified error handler is not installed, kQCErrHandlerNotFound will be returned.  If successful, kQCNoErr will be returned.
  129.  
  130.  
  131. QCGetErrorText
  132.  
  133. INTERFACE
  134. QCErr    QCGetErrorText(QCResult, StringPtr);
  135.  
  136. DESCRIPTION
  137. Given a valid QC error value (see Appendix D), get the text string that QC would report/log for that error.  This can be useful if you have installed an error handler but want access to the same error string QC would report for that error.  QCdoes not have to be active for this call.
  138.  
  139. RESULTS
  140. Possible errors could be kQCInvalididParam or kQCNotInstalled.
  141.  
  142.  
  143. QCGetTestState
  144.  
  145. INTERFACE
  146. Boolean    QCGetTestState(QCSelector);
  147.  
  148. DESCRIPTION
  149. Test whether a given test is currently active or not.  If the test is active true (1) is returned.  If the test is inactive or any error was encountered, false (0) is returned.
  150.  
  151.  
  152. QCSetTestState
  153.  
  154. INTERFACE
  155. QCErr    QCSetTestState(QCSelector, Boolean);
  156.  
  157. DESCRIPTION
  158. Set the test specified by QCSelector to an on (true) or off (false) state.
  159. RESULTS
  160. Possible errors could be kQCInvalidParam or kQCNotActive.
  161.  
  162.  
  163. QCGetTestOptions
  164.  
  165. INTERFACE
  166. QCErr    QCGetTestOptions(QCTestOptionsPtr);
  167.  
  168. DESCRIPTION
  169. Get the test options for the test specified in the 'testID' parameter if the QCTestOptionsPtr.  Depending on which test you are setting specific options for, different parameters of the QCTestOptionsPtr will be returned.
  170.  
  171. See Appendix Efor further information. Version 1.0 of QC only has test options for the 'AutoLaunch' and 'Reasonable Allocation' tests.
  172.  
  173. RESULTS
  174. Possible errors could be kQCInvalidType or kQCNotInstalled.
  175.  
  176.  
  177. QCSetTestOptions
  178.  
  179. INTERFACE
  180. QCErr    QCSetTestOptions(QCTestOptionsPtr);
  181.  
  182. DESCRIPTION
  183. Set the test options for the desired test, as specified in the 'testID' parameter if the QCTestOptionsPtr.  Depending on which test you are setting specific options for, different parameters must be filled in.  Please note that this call does not change the specified test's active state (on/off), just the options associated with it.
  184.  
  185. See Appendix Efor further information. Version 1.0 of QC only has test options for the 'AutoLaunch' and 'Reasonable Allocation' tests.
  186.  
  187. RESULTS
  188. Possible errors could be kQCInvalidType or kQCNotInstalled.
  189.  
  190.  
  191. QCHeapCheckNow
  192.  
  193. INTERFACE
  194. QCErr    QCHeapCheckNow(void);
  195.  
  196. DESCRIPTION
  197. Perform a heap check on the currently active heap, whether qcCheckHeap  (see Appendix B) is active or not.  Depending on the state of the test qcCheckSystemHeap this call will perform a block bounds check on the system heap as well.
  198. RESULTS
  199. Possible error could be kQCNotInstalled.
  200.  
  201.  
  202. QCScrambleHeapNow
  203.  
  204. INTERFACE
  205. QCErr    QCScrambleHeapNow(void);
  206.  
  207. DESCRIPTION
  208. Perform a heap scramble on the currently active heap, whether qcHeapScramble (see Appendix B) is active or not.  Depending on the state of the test qcCheckSystemHeap this call will perform a heap scramble on the system heap as well.
  209. RESULTS
  210. Possible error could be kQCNotInstalled.
  211.  
  212.  
  213. QCBlockBoundsCheckNow
  214.  
  215. INTERFACE
  216. QCErr    QCBlockBoundsCheckNow(void);
  217.  
  218. DESCRIPTION
  219. Perform a block bounds check on the currently active heap, whether qcBlockBoundsChecking  (see Appendix B) is active or not.  Depending on the state of the test qcCheckSystemHeap this call will perform a block bounds check on the system heap as well.
  220. RESULTS
  221. Possible error could be kQCNotInstalled.
  222.  
  223.  
  224. QCVerifyHandle
  225.  
  226. INTERFACE
  227. QCErr    QCVerifyHandle(Handle);
  228.  
  229. DESCRIPTION
  230. Given a handle, validate that it is a valid handle within the currently tested heap zone or the system heap zone.  This test will be performed even if the qcValidateHandlePointer test is not active.
  231.  
  232.  
  233. QCVerifyPointer
  234.  
  235. INTERFACE
  236. QCErr    QCVerifyPointer(Ptr);
  237.  
  238. DESCRIPTION
  239. Given a pointer, validate that it is a valid pointer within the currently tested heap zone or the system heap zone.  This test will be performed even if the qcValidateHandlePointer test is not active.
  240.